<ion-view title="我的订单">
  <ion-nav-buttons side="left">
    <a class="button button-icon icon ion-ios-arrow-left" ng-click="goBackPage()"></a>
  </ion-nav-buttons>
  <div class="orderguide_tabs c_tabs">
    <div class="c_tab_item " ng-click="tabStatusChange(1)">
      <span  class=" {{tabStatus==1?'active':''}}">预约</span>
    </div>
    <div class="c_tab_item" ng-click="tabStatusChange(2)">
      <span  class=" {{tabStatus==2?'active':''}}">服务中</span>
    </div>
    <div class="c_tab_item" ng-click="tabStatusChange(3)">
      <span class=" {{tabStatus==3?'active':''}}">已完成</span>
    </div>
  </div>
  <ion-content>
    <div class="o_guidecon">
      <div class="o_guidelist" ng-show="tabStatus==1">
        <div class="o_guideitem " ng-repeat="item in visitororders" ng-if="item.state==100 || item.state==101 || item.state==200">
          <div class="o_guideitem_con" ng-click="goorderdetail($index)">
            <img ng-src="{{item.headPic}}">
            <p>向导姓名：{{item.userName}}<span ng-if="item.state==101">预约成功</span><span ng-if="item.state==200">已取消</span><span ng-if="item.state==100">预约中</span></p>
            <p>出行日期：{{item.travelEndDate | to_dateYMDHM}}</p>
            <p>预定天数：{{calcdateDays(item.travelStartDate,item.travelEndDate)}}</p>
            <div class="o_guideitem_op">
              <h5>单号：{{item.orderId}}</h5>
              <div class="btns">
                <button ng-if="item.state==101" class="" ng-click="gopaypage($index);$event.stopPropagation();">去支付</button>
                <button  ng-if="item.state==100" class="" ng-click="userCancelOrder(item.orderId,item.state);$event.stopPropagation();">取消预约</button>
                <button  ng-if="item.state==200" class="" style="color:#f54710;    border: 1px solid #f54710;" ng-click="userdeleteOrder(item.orderId,item.state);$event.stopPropagation();">删除订单</button>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 服务中 -->
      <div class="o_guidelist " ng-show="tabStatus==2">
        <div class="o_guideitem " ng-repeat="item in visitororders"  ng-if="item.state==102 || item.state==103">
          <div class="   o_guideitem_con" ng-click="goorderdetail($index)">
            <img  ng-src="{{item.headPic}}">
            <p>向导姓名：{{item.userName}}<span ng-if="item.state==102">待向导服务</span><span ng-if="item.state==103">正在服务</span></p>
            <p>出行日期：{{item.travelEndDate | to_dateYMDHM}}</p>
            <p>预定天数：{{calcdateDays(item.travelStartDate,item.travelEndDate)}}</p>
            <div class="o_guideitem_op">
              <h5>单号：{{item.orderId}}</h5>
              <div class="btns">
                <button ng-if="item.state==103" class="" ng-click="visitorSureServiceOrder(item.orderId,item.state);$event.stopPropagation();">确认完成服务</button>
              </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 已完成 -->
      <div class="o_guidelist " ng-show="tabStatus==3">
        <div class="o_guideitem " ng-repeat="item in visitororders" ng-if="item.state==104">
          <div class="   o_guideitem_con" ng-click="goorderdetail($index)">
            <img  ng-src="{{item.headPic}}">
            <p>向导姓名：{{item.userName}}<span  ng-if="item.state==104">已完成</span></p>
            <p>出行日期：{{item.travelEndDate | to_dateYMDHM}}</p>
            <p>预定天数：{{calcdateDays(item.travelStartDate,item.travelEndDate)}}</p>
            <div class="o_guideitem_op">
              <h5>单号：{{item.orderId}}</h5>
              <div class="btns">
                <button ng-if="item.evaluateComment==undefined"  class=""  ng-click="commentOrder($index);$event.stopPropagation();">评价</button>
                <button ng-if="item.evaluateComment!==undefined" class=""  ng-click="commentOrder($index);$event.stopPropagation();">已评价</button>
                <button class="" ng-click="complaintOrder($index);$event.stopPropagation();" ng-if="item.complainComment==undefined">投诉</button>
                <button class="" ng-click="complaintOrder($index);$event.stopPropagation();" ng-if="item.complainComment!==undefined">已投诉</button>
<!--                 <button class="" ng-click="cancelOrder();$event.stopPropagation();" disabled="true">投诉</button>
                <button class="" ng-click="orderCOmmentDetail();$event.stopPropagation();" disabled="false">已评价</button> -->
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </ion-content>
</ion-view>
